package demo3;

import demo3.pellet.Mocha;
import demo3.pellet.Soy;
import demo3.specificdrink.Espresso;
import demo3.specificdrink.HouseBlend;
import org.junit.Test;

import java.io.*;

/**
 * @author 24岁没牵过女人的手 日期：2023/7/6 15:56 文件描述：
 */
public class StarbuzzCoffeee {
  @Test
  public void testCoffeeOrder() {
    Beverage espresso = new Espresso();
    System.out.println(espresso.getDescription() + "$" + espresso.cost());

    Beverage houseBlend = new HouseBlend();
    houseBlend = new Mocha(houseBlend);
    System.out.println(houseBlend.getDescription() + "$" + houseBlend.cost());

    Beverage espresso1 = new Espresso();
    espresso1 = new Mocha(espresso1);
    espresso1 = new Soy(espresso1);
    System.out.println(espresso1.getDescription() + "$" + espresso1.cost());
  }

  @Test
  public void testLowerCaseInputStream() throws IOException {
    int c = 0;
    try{
      InputStream in =
              new LowerCaseInputStream(
                      new BufferedInputStream(
                              new FileInputStream(
                                      "E:\\GIT\\GITEE\\Design_pattern\\src\\main\\java\\demo3\\test.txt")));
      while ((c = in.read()) >= 0){
        System.out.println(c);
        System.out.println((char) c);
      }
    }
    catch (IOException e){
      e.printStackTrace();
    }
  }
}
